Android tutorial - Gridview in android | Android GridView | Android GridView example - android app development - android studio - android development tutorial
Learn android - android tutorial - Gridlayout android example - android examples - android programs
Android GridView:
- GridView layout in one of the most useful layouts in android.
- Gridview is mainly useful when we want show data in grid layout like displaying images or icons.
- This layout can be used to build applications like image viewer, audio or video players in order to show elements in grid manner.
- GridView let you arranges components in a two-dimensional scrolling grid.
- GridView elements are not generally predefined and the data can be inserted into the layout using Adapters like ListAdapter etc.
- We can control the number of columns, their width, and relevant spacing.
- In this tutorial, we will show you 2 common GridView examples :
- Normal way, just display text in GridView layout.
- Create a custom adapter to display image and text in GridView layout.
- P.S This project is developed in Eclipse 3.7, and tested with Android 2.3.3.
1. Normal GridView example:
- Display characters from A to Z in GridView layout. Quite simple, it should be self-explanatory.
- 1.1 Android Layout file - res/layout/main.xml
1. Normal GridView example: 1.2 Activity
1.3 Demo - android emulator - android tutorial
2. Custom Adapter example:
- In this example, extend a BaseAdapter to display a group of image and text in GridView layout.
2.1 Two Android Layout files
- File - res/layout/main.xml
- File - res/layout/mobile.xml